package main

import (
	"alex/ptp1588boundaryclock/datasets"
	"alex/ptp1588boundaryclock/datatypes"
	"alex/ptp1588boundaryclock/state"
	"time"
)

func main () {
	defaultDS := new(datasets.DefaultDS)
	//defaultDS.TwoStepFlag = false -> bool is auto false
	defaultDS.NumberPorts = 0
	defaultDS.Priority1 = 13
	defaultDS.Priority2 = 13
	defaultDS.ClockIdentity = datatypes.ClockIdentity{0xFF, 0xFF, 0xA5, 0, 0, 0, 0, 0}
	defaultDS.ClockQuality = datatypes.ClockQuality{248, 0x2a, 0}

	currentDS := new(datasets.CurrentDS)
	//currentDS.StepsRemoved = 0

	parentDS := new(datasets.ParentDS)
	parentDS.ParentPortIdentity.ClockIdentity = defaultDS.ClockIdentity
	parentDS.ObservedParentOffsetScaledLogVariance = 0xFFFF
	parentDS.ObservedParentClockPhaseRateChange = 0x7FFFFFFF
	parentDS.GrandmasterIdentity = defaultDS.ClockIdentity
	parentDS.GrandmasterClockQuality = defaultDS.ClockQuality
	parentDS.GrandmasterPriority1 = defaultDS.Priority1
	parentDS.GrandmasterPriority2 = defaultDS.Priority2

	clock := new(state.Clock)
	clock.Init()

	portHandler := new(state.PortHandler)
	portHandler.Init(defaultDS, currentDS, parentDS, clock, 100)
	time.Sleep(10 * time.Second)
}

